
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
    service: 'qq',
    auth: {
        user: '1378056783@qq.com',
        pass: 'udndlgctolbvihhe' //授权码,通过QQ获取

    }
});
var mailOptions = {
    from: '1378056783@qq.com', // 发送者
    to: '2081911650@qq.com,y1378056783@163.com', // 接受者,可以同时发送多个,以逗号隔开
    subject: 'nodemailer5.1.1邮件发送', // 标题
    //text: 'Hello world', // 文本
    html: `<h2>nodemailer基本使用:Testing</h2>`,
    /*attachments: [附件参数
        {
            filename: 'package.json',
            path: './package.json'
        },
        {
            filename: 'content',
            content: '发送内容'
        }
    ]*/
};

transporter.sendMail(mailOptions, (err, info) => {
    if (err) {
        console.log(err);
        return;
    }

    console.log('发送成功');
});
